package handler

import (
	"context"
	"go-micro.dev/v4/logger"
	"order-service/model"

	pb "order-service/proto"
)

type OrderService struct{}

func (e *OrderService) Call(ctx context.Context, req *pb.CallRequest, rsp *pb.CallResponse) error {
	logger.Infof("Received OrderService.Call request: %v", req)
	rsp.Msg = "Hello " + req.Name
	vote := model.Vote{}
	model.DB.Where("id = ?", req.Id).Find(&vote)
	rsp.Code = vote.Username
	return nil
}
